jade.lang.sl
Class SL0Codec

java.lang.Object
  |
  +--jade.lang.sl.SL0Codec

public class SL0Codec
extends java.lang.Object
implements Codec

The codec class for the SL0 language. This class implements the Codec interface and allows converting back and forth between strings and frames, according to the SL0 grammar.

WARNING: When creating the Ontology, notice that this SL0Parser returns a Java object of type Long everytime it parses an integer, and it returns a Java object of type Double everytime it parses a float. Therefore, the slots of the frames in the ontology must be of type, respectively, Ontology.LONG_TYPE and Ontology.DOUBLE_TYPE, otherwise you get an IllegalArgumentException.

Notice also that the following convention is needed for all the frames representing actions: the name of the frame must be NAME_OF_ACTION_FRAME, and the name of the two slots representing actor and the action term must be, respectively, NAME_OF_ACTOR_SLOT and NAME_OF_ACTION_SLOT.

Author:
Giovanni Rimassa - Universita` di Parma

Inner classes inherited from class jade.lang.Codec
Codec.CodecException
 
Field Summary
static java.lang.String NAME
          A symbolic constant, containing the name of this language.
static java.lang.String NAME_OF_ACTION_FRAME
          Symbolic constant identifying a frame representing an action
static java.lang.String NAME_OF_ACTION_SLOT
          Symbolic constant identifying a slot representing an action
static java.lang.String NAME_OF_ACTOR_SLOT
          Symbolic constant identifying a slot representing an actor
 
Constructor Summary
SL0Codec()
           
 
Method Summary
 List decode(java.lang.String s, Ontology o)
          Decodes a given String, according to the given Content Language and obtains a t-uple of Frame objects.
 java.lang.String encode(List v, Ontology o)
          Encodes a t-uple of Frame objects into a Java String, according to this Content Language and Ontology by looking up the given ontology for the role played by symbols (i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static final java.lang.String NAME
A symbolic constant, containing the name of this language.

NAME_OF_ACTION_FRAME

public static java.lang.String NAME_OF_ACTION_FRAME
Symbolic constant identifying a frame representing an action

NAME_OF_ACTOR_SLOT

public static java.lang.String NAME_OF_ACTOR_SLOT
Symbolic constant identifying a slot representing an actor

NAME_OF_ACTION_SLOT

public static java.lang.String NAME_OF_ACTION_SLOT
Symbolic constant identifying a slot representing an action
Constructor Detail

SL0Codec

public SL0Codec()
Method Detail

encode

public java.lang.String encode(List v,
                               Ontology o)
Description copied from interface: Codec
Encodes a t-uple of Frame objects into a Java String, according to this Content Language and Ontology by looking up the given ontology for the role played by symbols (i.e. whether they are concepts, actions or predicates).
Specified by:
encode in interface Codec
Tags copied from interface: Codec
Parameters:
f - The List of frames to encode as a t-uple.
o - The ontology to use to lookup the roles for the various symbols.
Returns:
A Java string, representing the given frame according to this content language.

decode

public List decode(java.lang.String s,
                   Ontology o)
            throws Codec.CodecException
Description copied from interface: Codec
Decodes a given String, according to the given Content Language and obtains a t-uple of Frame objects. This method can use the given ontology to distinguish among the different kinds of roles a symbol can play (i.e. Concept vs. Action vs. Predicate).
Specified by:
decode in interface Codec
Tags copied from interface: Codec
Parameters:
s - A string containing the representation of an ontological element, encoded according to this content language.
o - The ontology to use to lookup the roles for the various symbols.
Returns:
A List of frame, representing the given ontological elements.